
cat /etc/issue
Ubuntu 22.04.4 LTS \n \l

uname  -r
6.5.0-25-generic





export GOPROXY='https://goproxy.cn,https://mirrors.aliyun.com/goproxy,direct'

export GOROOT="/home/yd/go1.21.8"
export GOPATH="/home/yd/gopath1.21.8"


export PATH="$PATH:/home/yd/gopath1.21.8/bin:/home/yd/go1.21.8/bin"

/home/yd/go1.21.8/bin/go mod init ebpf-test

/home/yd/go1.21.8/bin/go mod tidy

/home/yd/go1.21.8/bin/go get github.com/cilium/ebpf/cmd/bpf2go@v0.12.3


rm -rf  counter_bpfel.go
rm -rf  counter_bpfel.o

rm -rf  counter_bpfeb.go
rm -rf counter_bpfeb.o


/home/yd/go1.21.8/bin/go generate

/home/yd/go1.21.8/bin/go build


ip  netns add n1

ip  link add  veth0  type veth peer name veth1

ip link set veth1 netns  n1

ip netns exec  n1  ip  addr add  10.2.1.1/24 dev veth1

ip netns exec  n1 ip  link set  veth1  up


ip  addr add  10.2.1.2/24 dev veth0

ip  link set  veth0  up



ip netns exec  n1   ping 10.2.1.2


test xdp drop


ip netns exec  n1   ip   addr  add  10.2.1.1/24  dev veth1
ip netns exec  n1   ping 10.2.1.2


ip netns exec  n1   ip   addr  del  10.2.1.1/24  dev veth1
ip netns exec  n1   ip   addr  add  10.2.1.3/24  dev veth1
ip netns exec  n1   ping 10.2.1.2

ip netns exec  n1 ip a
10.2.1.3


ip netns exec  n1   ip   addr  del  10.2.1.1/24  dev veth1


